﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing.Drawing2D;
using System.Drawing;



using System.ComponentModel;
using System.Data;

using System.Windows.Forms;


namespace Dreaming_of_Space_2
{
    public class SolarPRO
    {
        public int money = 5000;
        public int max_fire_distance = 110;
        public int max_damage = 5;


        public bool set_tower_enabled = false;
        //Про солнечной системы
        public  int MaxTowerQuantity = 50;
        public Tower[] ProSolarSys = new Tower[50];
        public int TowerQuantity = 0;

        public bool DetectSelectObject(int x_MouseDown_1, int y_MouseDown_1)
        {
            bool ret_val = false;
            for (int i = 0; i < TowerQuantity; i++)
            {
                if ((x_MouseDown_1 - ProSolarSys[i].Pos.X) * (x_MouseDown_1 - ProSolarSys[i].Pos.X) +
                     (y_MouseDown_1 - ProSolarSys[i].Pos.Y) * (y_MouseDown_1 - ProSolarSys[i].Pos.Y) < 25)
                {
                    ProSolarSys[i].select = true;
                    ret_val = true;
                }
                else ProSolarSys[i].select = false;
            }
            return ret_val;
        }
        public bool CheckDistanse(int x_MouseDown_1, int y_MouseDown_1)
        {
            for (int i = 0; i < TowerQuantity; i++)
            {
                if ((x_MouseDown_1 - ProSolarSys[i].Pos.X) * (x_MouseDown_1 - ProSolarSys[i].Pos.X) +
                     (y_MouseDown_1 - ProSolarSys[i].Pos.Y) * (y_MouseDown_1 - ProSolarSys[i].Pos.Y) < 900)

                    return false;

            }
            return true;
        }

        public bool SetNewTower(int x_MouseDown_1, int y_MouseDown_1, Graphics myGraphics)
        {
            //Graphics myGraphics = CreateGraphics();
            
            Tower NewTower = new Tower();
            NewTower.Pos.X = x_MouseDown_1;
            NewTower.Pos.Y = y_MouseDown_1;
            ProSolarSys[TowerQuantity] = NewTower;
            ProSolarSys[TowerQuantity].SetTower(x_MouseDown_1, y_MouseDown_1, myGraphics);
            money -= 2000;
            TowerQuantity++;
            set_tower_enabled = false;
            return true;
        }

    }
}
